package indi.zhifa.study2024.core.mpenhence.entity.po;

import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;


@Data
public class BaseEntity extends SysBaseEntity{

    @JSONField(serialize = false, deserialize = false)
    @TableField(fill = FieldFill.INSERT)
    @Schema(title = "创建用户Id")
    protected Long createId;
    @JSONField(serialize = false, deserialize = false)
    @TableField(fill = FieldFill.INSERT)
    @Schema(title = "创建用户昵称")
    protected String createName;

    @JSONField(serialize = false, deserialize = false)
    @TableField(fill = FieldFill.UPDATE)
    @Schema(title = "修改用户Id")
    protected Long modifyId;
    @JSONField(serialize = false, deserialize = false)
    @TableField(fill = FieldFill.UPDATE)
    @Schema(title = "修改用户昵称")
    protected String modifyName;

    @Override
    public void createInit() {
        super.createInit();
        // 靠全局配置填充
        createId = null;
        createName = null;
        modifyId = null;
        modifyName = null;
        version = 0;
        del = 0L;
    }

    @Override
    public void updateInit() {
        super.updateInit();
        modifyId = null;
        modifyName = null;
    }

}
